{extend name="layout/base" /}
<!-- 标题 -->
{block name="title"}{$column['column_name']}{/block}
<!-- CSS -->
{block name="css"}{/block}

<!-- 具体内容 -->
{block name="content"}
<h2 class="header-dividing">{$column['column_name']} <small>{$column['column_enname']}</small></h2>
<div class="navbar navbar-default navbar-content">
    <div class="collapse navbar-collapse">
        <ul class="nav navbar-nav">
            <li><a href="{:url('@admin/wscolumn', $urlparam)}"> <i class="icon icon-lightbulb"></i> 栏目设置</a></li>
        </ul>
        <!-- 导航中的表单 -->
        <form class="navbar-form navbar-left" role="search" method="get" action="{:url('@admin/wsmessage')}">
            <input type="hidden" name="siteid" value="{$siteid}">
            <input type="hidden" name="columnid" value="{$columnid}">
            <select class="form-control" name="status">
                <option value="">选择状态</option>
                <option value="0" {$status=='0'?'selected':''}>待审核</option>
                <option value="1" {$status=='1'?'selected':''}>审核完成</option>
            </select>
            <input type="text" class="form-control" name="keywords" placeholder="搜索" value="{$keywords}">
            <button type="submit" class="btn btn-default">搜索</button>
            <button type="button" class="btn" data-remote="{:url('@admin/help/main')}" data-show-header="false" data-toggle="modal">帮助</button>
        </form>
    </div>
</div>
<div class="panel">
    <table class="table datatable table-fixed" data-checkable="true" data-check-by-click-row="false" data-fixed-left-width="250" data-fixed-right-width="240">
        <thead>
            <tr>
                <th data-width="80" width="80">ID</th>
                <th data-width="120" width="120">姓名</th>
                <th data-width="150" class="flex-col">电话</th>
                <th data-width="150" class="flex-col">邮箱</th>
                <th data-width="200"  class="flex-col">主题</th>
                <th class="flex-col">内容</th>
                <th data-width="180" class="flex-col">留言时间</th>
                <th data-width="80" width="80" class="text-center">状态</th>
                <th data-width="80" width="80" class="text-center">审核</th>
                <th data-width="80" width="80" class="text-center">删除</th>
            </tr>
        </thead>
        <tbody>
            {volist name="list" id="vo"}
            <tr data-id="{$vo['wsmessage_id']}">
                <td>{$vo['wsmessage_id']}</td>
                <td>{$vo['wsmessage_name']}</td>
                <td><div class="text-nowrap text-ellipsis" title="{$vo['wsmessage_phone']}">{$vo['wsmessage_phone']}</div></td>
                <td><div class="text-nowrap text-ellipsis" title="{$vo['wsmessage_email']}">{$vo['wsmessage_email']}</div></td>
                <td><div class="text-nowrap text-ellipsis" title="{$vo['wsmessage_title']}">{$vo['wsmessage_title']}</div></td>
                <td><div class="text-nowrap text-ellipsis" title="{$vo['wsmessage_desc']}">{$vo['wsmessage_desc']}</div></td>
                <td>{$vo['wsmessage_create_time']}</td>
                <td class="text-center">{$vo['wsmessage_status_html']|raw}</td>
                <td class="text-center">
                    {if($vo['wsmessage_status']=='0')}
                    <a class="update" data-url="{:url('@admin/wsmessage/update', 'id='.$vo['wsmessage_id'])}">确认</a>
                    {/if}
                </td>
                <td class="text-center"><a class="delete" data-url="{:url('@admin/wsmessage/delete','id='.$vo['wsmessage_id'])}">删除</a></td>
            </tr>
            {/volist}
        </tbody>
    </table>
    {empty name="list"}
    <div class="mb20 mt20 text-center">
        {if ($keywords!='' || $status != '')}
            未搜索到 “{$keywords}” 相关的内容 &nbsp; <a href="{:url('@admin/wsmessage', $urlparam)}">查看全部内容</a>
        {else /}
            暂未添加内容
        {/if}
    </div>
    {/empty}
    {notempty name="list"}
    <div class="mb10 ml10">
        <button class="btn btn-danger check-delete" type="button" data-url="{:url('@admin/wsmessage/delete')}">删除内容</button> 
        <button class="btn btn-primary check-update" type="button" data-url="{:url('@admin/wsmessage/update')}">确认查看</button> 
    </div>
    {/notempty}
</div>

<div class="text-center mb20">
    {$list|raw}
</div>
{/block}

<!-- JS -->
{block name="js"}{/block}
{block name="jscode"}
<script type="text/javascript">
$(document).ready(function() {
    /** 确认 **/
    $('.update').click(function(event) {
        var url = $(this).data('url');
        bootbox.confirm({
            message: "该内容确定查看？",
            callback: function(result) {
                if (result) {
                    sxj.ajax_get(url);
                }
            }
        });
    });

    /** 批量确认 **/
    $('.check-update').click(function(event) {
        var $url = $(this).data('url');
        // 获取数据表格实例对象
        var myDatatable = $('table.datatable').data('zui.datatable');
        // 获取行选中数据
        var checksStatus = myDatatable.checks;
        if (checksStatus == undefined) {
            return sxj.msg_error('请先选择内容！');
        }
        bootbox.confirm({
            message: "该内容确定查看？",
            callback: function(result) {
                if (result) {
                    sxj.ajax_get($url + '?id=' + checksStatus.checks.toString());
                }
            }
        });
    });

});
</script>
{/block}